﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl docsum xsi"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:docsum="http://www.ncbi.nlm.nih.gov/SNP/docsum"
    xmlns="http://www.w3.org/1999/xhtml"
>
    <xsl:output method="xml" indent="yes"/>

  <xsl:template match="/">
    <html lang="en" xml:lang="en">
      <head>
        <title>NCBI results for rs<xsl:value-of select="docsum:ExchangeSet/docsum:Rs/docsum:Rs_rsId"/>
        </title>
        <style type="text/css">
          body, th, td {
            font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
            font-size: 8pt;
          }
          h1 { font-size: 10pt; }
          table { border-collapse: collapse; border: solid 1px black; }
          th, td { border: solid 1px black; padding: 2px 5px; }
          th { text-align: left; }
        </style>
      </head>
      <body>
        <h1>
          NCBI results for rs<xsl:value-of select="docsum:ExchangeSet/docsum:Rs/docsum:Rs_rsId"/>
        </h1>
        <table>
          <tr>
            <th>Field</th>
            <th>Value</th>
          </tr>
          <tr>
            <td>Accession number</td>
            <td>
              rs<xsl:value-of select="docsum:ExchangeSet/docsum:Rs/docsum:Rs_rsId"/>
            </td>
          </tr>
          <tr>
            <td>Organism</td>
            <td>
              <xsl:value-of select="docsum:ExchangeSet/docsum:Rs/docsum:Rs_organism"/>
            </td>
          </tr>
          <tr>
            <td>Entrez gene IDs</td>
            <td>
              <xsl:for-each select="docsum:ExchangeSet/docsum:Rs/docsum:Rs_assembly/docsum:Assembly[docsum:Assembly_groupLabel='reference']/docsum:Assembly_component/docsum:Component/docsum:Component_mapLoc/docsum:MapLoc/docsum:MapLoc_fxnSet/docsum:FxnSet[1]">
                <xsl:value-of select="docsum:FxnSet_geneId"/>
                <br />
              </xsl:for-each>
            </td>
          </tr>
          <tr>
            <td>Gene names</td>
            <td>
              <xsl:for-each select="docsum:ExchangeSet/docsum:Rs/docsum:Rs_assembly/docsum:Assembly[docsum:Assembly_groupLabel='reference']/docsum:Assembly_component/docsum:Component/docsum:Component_mapLoc/docsum:MapLoc/docsum:MapLoc_fxnSet/docsum:FxnSet[1]">
                <xsl:value-of select="docsum:FxnSet_symbol"/>
                <br />
              </xsl:for-each>
            </td>
          </tr>
          <tr>
            <td>Chromosome</td>
            <td>
              <xsl:for-each select="docsum:ExchangeSet/docsum:Rs/docsum:Rs_assembly/docsum:Assembly[docsum:Assembly_groupLabel='reference']/docsum:Assembly_component/docsum:Component">
                <xsl:value-of select="docsum:Component_chromosome"/>
                <br />
              </xsl:for-each>
            </td>
          </tr>
          <tr>
            <td>Position</td>
            <td>
              <xsl:for-each select="docsum:ExchangeSet/docsum:Rs/docsum:Rs_assembly/docsum:Assembly[docsum:Assembly_groupLabel='reference']/docsum:Assembly_component/docsum:Component/docsum:Component_mapLoc/docsum:MapLoc">
                <xsl:value-of select="docsum:MapLoc_physMapInt"/>
                <br />
              </xsl:for-each>
            </td>
          </tr>
        </table>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>
